package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.util.Collection;
import java.util.Objects;

@Entity
public class Functiona {
    private int functionaId;
    private String functionaName;
    private String functionaUrl;
    private String functionaLcon;
    private Integer parentId;
    private Fun funByFunId;

    @Id
    @Column(name = "functiona_id", nullable = false)
    public int getFunctionaId() {
        return functionaId;
    }

    public void setFunctionaId(int functionaId) {
        this.functionaId = functionaId;
    }

    @Basic
    @Column(name = "functiona_name", nullable = true, length = 30)
    public String getFunctionaName() {
        return functionaName;
    }

    public void setFunctionaName(String functionaName) {
        this.functionaName = functionaName;
    }

    @Basic
    @Column(name = "functiona_url", nullable = true, length = 255)
    public String getFunctionaUrl() {
        return functionaUrl;
    }

    public void setFunctionaUrl(String functionaUrl) {
        this.functionaUrl = functionaUrl;
    }

    @Basic
    @Column(name = "functiona_lcon", nullable = true, length = 255)
    public String getFunctionaLcon() {
        return functionaLcon;
    }

    public void setFunctionaLcon(String functionaLcon) {
        this.functionaLcon = functionaLcon;
    }

    @Basic
    @Column(name = "parent_id", nullable = true)
    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Functiona functiona = (Functiona) o;
        return functionaId == functiona.functionaId &&
                Objects.equals(functionaName, functiona.functionaName) &&
                Objects.equals(functionaUrl, functiona.functionaUrl) &&
                Objects.equals(functionaLcon, functiona.functionaLcon) &&
                Objects.equals(parentId, functiona.parentId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(functionaId, functionaName, functionaUrl, functionaLcon, parentId);
    }

    @ManyToOne
    @JoinColumn(name = "fun_id", referencedColumnName = "fun_id")
    public Fun getFunByFunId() {
        return funByFunId;
    }

    public void setFunByFunId(Fun funByFunId) {
        this.funByFunId = funByFunId;
    }


}
